package com.cskaoyan.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

@Data
public class MallUser {
    private Integer id;

    private String username;

    private String password;

    private Byte gender;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthday;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastLoginTime;

    private String lastLoginIp;

    private Byte userLevel;

    private String nickname;

    private String mobile;

    private String avatar;

    private String weixinOpenid;

    private String sessionKey;

    private Byte status;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date addTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    private Boolean deleted;

    public void setAddTime(Date addTime) {
        if (addTime == null) {
            addTime = new Date();
        }
        this.addTime = addTime;
    }


    public void setUpdateTime(Date updateTime) {
        if (updateTime == null) {
            updateTime = new Date();
        }
        this.updateTime = updateTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        if (lastLoginTime == null) {
            lastLoginTime = new Date();
        }
        this.lastLoginTime = lastLoginTime;
    }
}